<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@ taglib prefix="s" uri="/struts-tags"%>
<%String path = request.getContextPath();%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>充值</title>
  </head>
  <script type="text/javascript">
  	function changeType(value){
  		if(value == 'CASH'){
  			$("#moneyLabel").text("充值金额：");
  			$("#productDiv").hide();
  			$("#countDiv").hide();
  			$("#productId").removeClass("require");
  			$("#count").removeClass("require");
  			$("#money").addClass("require");
  			$("#moneyDiv").show();
  		}else if(value == 'SCORE'){
  			$("#moneyLabel").text("积分数量：");
  			$("#productLabel").hide();
  			$("#productId").hide();
  			$("#countDiv").hide();
  			$("#productId").removeClass("require");
  			$("#count").removeClass("require");
  			$("#money").addClass("require");
  			$("#moneyDiv").show();
  		}else{
  			$("#moneyDiv").hide();
  			$("#money").removeClass("require");
  			$("#productId").addClass("require");
  			$("#count").addClass("require");
  			$("#productDiv").show();
  			$("#countDiv").show();
  		}
  	}
  	
  	
$("#button-close-dialog").click(function() {
    $.pdialog.close("closeRechargeDialog");
});
  </script>
  
  <body>
<div class="pageContent">
				<form method="post" id="CashForm"  style="display:block" action="<%=path%>/memberCard/saveRechargeCard.action" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
						<div class="pageFormContent" layoutH="56">
							<c:if test="${rechargeTargetType == 'MEMBERCARD'}">
								<p>
									<label>充值类型：</label>
				                   <select name="rechargeLog.type" id="rechargeLogType" onchange="changeType(this.value);">
				                        <c:forEach var="item" items="${rechargeTypeTypes}">
				                        	<option value="${item.name}" ${rechargeLog.type eq item.name ? "selected" : ""}>${item.title}</option>
				                        </c:forEach>
				                   </select>
								</p>
							</c:if>
							<p  id="moneyDiv">
									<label id="moneyLabel">充值金额：</label>
									<input id="money" name="money" value="" class="number require" type="text"/>
									<input name="memberIds" value="${memberIds}" type="hidden"/>
									<input name="rechargeTargetType" value="${rechargeTargetType}" type="hidden"/>
							</p>
							
							<c:if test="${rechargeTargetType == 'MEMBERCARD'}">
								<p id="productDiv" style="display:none">
									<label id="productLabel">商品：</label>
									<input name="memberCardCostCountVO.productId" value="<s:property value="memberCardCostCountVO.product.id" />" type="hidden">
									<input onclick="$('#recharge_a_btnLook').trigger('click');" style="cursor: pointer;float: left;" name="memberCardCostCountVO.productName" value="<s:property value="memberCardCostCountVO.productName" />" readonly>
									<a class="btnLook" id="recharge_a_btnLook" href="<%=path %>/product/listProduct.action?searchType=lookup" lookupGroup="memberCardCostCountVO">选择</a>
									<!-- 
									<select name="memberCardCostCountVO.product.id" id="productId">
				                        <option value="">==选择商品==</option>
				                        <c:forEach var="item" items="${products}">
				                        	<option value="${item.id}" ${memberCardCostCountVO.product.id eq item.id ? "selected" : "" }>${item.name}</option>
				                        </c:forEach>
				                   </select>
				                    -->
								</p>
								<p  id="countDiv" style="display:none">
									<label>次数：</label>
									<input id="count" name="memberCardCostCountVO.count" value="<s:property value="memberCardCostCountVO.count" />" class="number" type="text"/>
								</p>
								<p  id="countDiv">
									<label>说明：</label>
									<textarea name="rechargeLog.description" value="" type="text" size="30"/>
								</p>
								</c:if>
							</div>	
							 <div class="formBar">
								<ul>
									<li><div class="buttonActive"><div class="buttonContent"><button type="submit">确定</button></div></div></li>
									<li>
										<div class="button"><div class="buttonContent"><button type="button" id="closeRechargeDialog" class="close">取消</button></div></div>
									</li>
								</ul>
							</div>
				</form>
</div>
</body>
</html>